// Raj Akula
// CSC 362
// October 04, 2009
// Programing Assignment 2

//Using my header file i created which contains all needed import statements and function prototypes
# include "myheader.h"

//Main function for main logic of the program to print header and convert to binary and evaluate function
void main()
{

	//This is used for the numerical value of the number for the truth table
	int number = 0;
	//This is the integers that are used for to represent binary values of a number
	int a, b, c, d, e;
	//This is the counter used to get the solution for a given number for each function
	int count = 1;
    int temp;
	//Is used to run through each function
	while ( count <= 4 ) 
	{
		
		int output = 0;
		printHeader(count);
		printHeader(0);
		number = 0;
		// Used to run through each number 0 - 32 and get corresponding binary value and function values... 

		while(number < 32){	
			//Variable used to see if function evaluates to be true or false		
			int value;
			//Converting number into boolean subset values
			booleanValue(number, &a, &b, &c, &d, &e);
			//If statements used to see which function to run and calling that function
			if (count == 1){
				value = function1(a, b, c, d , e);
				printOutput(a,b,c,d,e,value);
				if (value == 1)
					output++;
			}
			else if (count == 2){
			    value = function2(a, b, c, d, e);
				printOutput(a,b,c,d,e,value);
				if (value == 1)
					output++;
			}
			else if (count == 3){
				value = function3(a, b, c, d, e);
				printOutput(a,b,c,d,e,value);
				if (value == 1)
					output++;
			}
			else if (count == 4){			
				value = function4(a, b, c, d, e);
				printOutput(a,b,c,d,e,value);
				if (value == 1)
					output++;
			}
			number++; //Going to next number to find truth value of....
		}
		printf("Total Number of True Values is: %d\n\n", output); //Outputiing total no of true values in given function
		count++; //Going to solve next function truth values and so forth.
		printf("Press a number and press enter to go onto the next function !!!!!");
		scanf("%d", &temp);		
	}
}